package services;

import domain.entities.InvestigadorProtocoloCentro;

import java.util.List;
import java.util.regex.Pattern;

public abstract class Criteria {
    public boolean isIn(Object element){
        return true;
    }

    public boolean isSubstring(String a, String b){
        return
            (a == null
                ||
                a.trim().equals("")
                ||
                Pattern.compile(Pattern.quote(a), Pattern.CASE_INSENSITIVE).matcher(b).find()
        ) ;
    }

    public boolean isSubstring(Integer a, Integer b){
        return
                (a == null
                        ||
                        Pattern.compile(Pattern.quote(a.toString()), Pattern.CASE_INSENSITIVE).matcher(b.toString()).find()
                ) ;
    }
}
